package com.rzj.sys_lab_assistant.service.impl;

import com.rzj.sys_lab_assistant.dao.AssistantRepairMapper;
import com.rzj.sys_lab_assistant.entity.AssistantRepair;
import com.rzj.sys_lab_assistant.service.IAssistantRepairService;
import com.rzj.sys_lab_assistant.utils.TimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: sys_lab_assistant
 * @description:
 * @author: 作者
 * @create: 2021-07-02 22:02
 */
@Service
public class AssistantRepairServiceImpl implements IAssistantRepairService {

    @Autowired
    AssistantRepairMapper assistantRepairMapper;

    TimeUtils timeUtils;

    @Override
    public List<AssistantRepair> listAssistantRepairs(int aId) {
        return assistantRepairMapper.listAssistantRepairs(aId);
    }

    @Override
    public List<AssistantRepair> listAssistantRepairsByLab(int labId) {
        return assistantRepairMapper.listAssistantRepairsByLab(labId);
    }

    @Override
    public AssistantRepair getAssistantRepairById(int repairId) {
        return assistantRepairMapper.getAssistantRepairById(repairId);
    }

    @Override
    public int saveAssistantRepair(AssistantRepair assistantRepair) {
        assistantRepair.setCreateTime(timeUtils.getTime());
        assistantRepair.setModifyTime(timeUtils.getTime());
        return assistantRepairMapper.saveAssistantRepair(assistantRepair);
    }

    @Override
    public int updateAssistantRepair(AssistantRepair assistantRepair) {
        assistantRepair.setModifyTime(timeUtils.getTime());
        return assistantRepairMapper.updateAssistantRepair(assistantRepair);
    }

    @Override
    public int deleteAssistantRepair(int repairId) {
        return assistantRepairMapper.deleteAssistantRepair(repairId);
    }
}
